package org.example.bookssystem.Service;

import org.example.bookssystem.Dao.BookDao;
import org.example.bookssystem.model.BookInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:做渐进主义的改良派,不做完没注意的速成派
 * User: XALEXC
 * Date: 2024-10-23
 * Time: 19:39
 */
@Component
public class BookService {

    @Autowired
    private BookDao bookDao;

    public List<BookInfo> getBookInfos() {

        List<BookInfo> bookInfos = bookDao.mockData();
        for (BookInfo bookInfo : bookInfos) {
            if (1 == bookInfo.getStatus()) {
                bookInfo.setStatusCN("可借阅");
            } else {
                bookInfo.setStatusCN("不可借阅");
            }

        }
        return bookInfos;
    }
}

